package com.homework02;

/*
某小伙想定一份外卖，商家的优惠方式如下：
鱼香肉丝单点24元，油炸花生米单点8元，米饭单点3元。
订单满30元8折优惠。鱼香肉丝优惠价16元，
但是优惠价和折扣不能同时使用。
那么这个小伙要点这三样东西，最少要花多少钱？
*/
public class work01 {
    public static void main(String[] args) {
        //1.将是三个商品的数据先记录
        int fishmeat = 24;
        int peanuts = 8;
        int rice = 3;
        //2.计算两种方案分别都少钱
        //优惠价方案
        int first = 16 + peanuts + rice;
        //折扣价方案
        double second = (fishmeat + peanuts + rice) >= 30 ? (fishmeat + peanuts + rice) * 0.8 : (fishmeat + peanuts + rice);
        //选出便宜的方案
        double minmoney = first < second ? first : second;
        System.out.println("最少要花"+minmoney+"元");

    }
    /*public static void main(String[] args) {
        int fishmeat = 24;
        int Peanuts = 8;
        int rice = 3;

        double sum = 0;
        for (int i = 1; i <= 1; i++) {
            for (int j = 1; j <= 3; j++) {
                for (int k = 1; k <= 10; k++) {
                    sum = fishmeat * i + Peanuts * j + rice * k;
                    if (sum < 36) {//总价最多不能超过30+最大优惠力度
                        System.out.println("鱼香肉丝=" + i + ",花生米=" + j + ",米饭=" + k + ",总价=" + sum);
                        double soeciaprice = sum * 0.8;
                        double soeciaprice2 = sum - (i * 8);
                        System.out.println("打八折后:" + soeciaprice);
                        System.out.println("鱼香肉丝优惠后:" + soeciaprice2);
                        if (soeciaprice2 < soeciaprice) {
                            System.out.println("鱼香肉丝优惠方案花费最少");
                        } else {
                            System.out.println("打八折方案花费最少");
                        }
                    }
                }

            }
        }

    }*/

}
